package com.shopping.alarm;

import com.shopping.alarm.ding.DingTalkMessage;
import com.shopping.alarm.ding.DingTalkTextMessage;
import com.shopping.alarm.properties.DingTalkConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

@Slf4j
@Configuration
@ConditionalOnWebApplication
@EnableConfigurationProperties({DingTalkConfig.class})
public class DingTalkAutoConfiguration {
    
    @Bean
    public DingTalkMessage dingTalkMessage() {
        return new DingTalkMessage();
    }

    @Bean
    public DingTalkTextMessage dingTalkTextMessage() {
        return new DingTalkTextMessage();
    }


    @Bean
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}
